<template>
  <el-form
    :inline="true"
    :model="doctorDialogForm"
    size="small"
    :rules="baseRules"
    ref="baseForm"
  >
    <el-form-item label="医生名称" prop="name">
      <el-input v-model="doctorDialogForm.name"></el-input>
    </el-form-item>
    <span class="dialog-footer">
      <el-button @click="cancelOperation()">取 消</el-button>
      <el-button type="primary" @click="confirmOperation()">确 定</el-button>
    </span>
  </el-form>
</template>

<script>
  //   import { ElForm, ElFormItem, ElInput, ElButton } from "element-plus";
  export default {
    name: "Doctor",
    data() {
      return {
        doctorDialogForm: {
          // 模态框 - 医生信息
          no: "", // 医生编号
          name: "", // 医生名称
          title: "", // 医生职称
          gender: "", // 性别
          hospital: "", // 所在医院
        },
        baseRules: {
          name: [
            { required: true, message: "请输入医生名称", trigger: "blur" },
          ],
          title: [{ required: true, message: "请选择职称", trigger: "change" }],
          gender: [
            { required: true, message: "请选择性别", trigger: "change" },
          ],
          hospital: [
            { required: true, message: "请选择医院", trigger: "change" },
          ],
        },
      };
    },
    methods: {
      confirmOperation() {
        this.$refs.baseForm.validate((valid) => {
          if (!valid) {
            this.$message.warning("请调整数据后再请求");
            return false;
          }
          // operation code
        });
      },
    },
  };
</script>
